package com.small.sentinel.slotchain;

import com.small.common.core.spi.SpiLoader;
import com.small.common.designPattern.behavioral.chainOfResponsibility.slotchain.ProcessorSlotChain;
import com.small.sentinel.slots.DefaultSlotChainBuilder;

public class SlotChainProvider {

    private static volatile SlotChainBuilder slotChainBuilder = null;

    private SlotChainProvider() {}

    static {
        slotChainBuilder = SpiLoader.newInstance(SlotChainBuilder.class).loadFirstInstance();
        if (slotChainBuilder == null){
            slotChainBuilder = new DefaultSlotChainBuilder();
        }
    }

    public static ProcessorSlotChain newSlotChain() {
        return slotChainBuilder.build();
    }


}
